#include <stm8s_clk.h>

void CLK_SWIMConfig(CLK_SWIMDivider_TypeDef CLK_SWIMDivider)
{
  /* check the parameters */
  assert_param(IS_CLK_SWIMDIVIDER_OK(CLK_SWIMDivider));
  
  if (CLK_SWIMDivider != CLK_SWIMDIVIDER_2)
  {
    /* SWIM clock is not divided by 2 */
    CLK->SWIMCCR |= CLK_SWIMCCR_SWIMDIV;
  }
  else /* CLK_SWIMDivider == CLK_SWIMDIVIDER_2 */
  {
    /* SWIM clock is divided by 2 */
    CLK->SWIMCCR &= (uint8_t)(~CLK_SWIMCCR_SWIMDIV);
  }
}

/**
  * @brief  Enables the Clock Security System.
  * @par Full description:
  * once CSS is enabled it cannot be disabled until the next reset.
  * @param  None
  * @retval None
  */
